package com.ch.http;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Tomcat {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(80);

        while(true){
            try {
                Socket socket = serverSocket.accept();
                InputStream in = socket.getInputStream();
                OutputStream out = socket.getOutputStream();

                byte[] bytes = new byte[1024*4];
                int read = in.read(bytes);

                String s = new String(bytes, 0, read);
                System.out.println(s);
            } catch (Exception e) {
                System.out.println("==========" + e.getMessage());
            }
        }

    }
}
